import jwt from "jsonwebtoken";

export const SECRETKEY = "SERVER"; // 密钥
export const ALGORITHM = "HS256";
// 生成token
export const setToken = (payload: any) => {
  const token = jwt.sign(payload, SECRETKEY, {
    algorithm: ALGORITHM, // 加密算法，默认HS256
    expiresIn: "2h", // 过期时间
  });
  return token;
};
